home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 47
/
047.d81
/
memory challenge
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
9KB
|
268 lines
10 m$="[157][157][157][165][191][167]":cd$="[158][207][163][208]"+m$+m$+"[157][157][157][204][164][186]"
20 dim b$(9,4),c$(36,4),l$(37),a(36),d(36),p$(4),tr(10),h(10)
30 dim n1(33),n2(33),s(20),t(20),g(30),w$(30),hs(30),le(30),j(12),k(12)
40 gosub1790:nu=1:al=1:le=16
50 forx=1to8:readn3(x),n4(x),dr(x):next
60 forx=1to36:readd(x):next
70 forx=1to12:readj(x),k(x):next
80 print"[147]":poke53281,14:poke646,1
90 print"*** memory challenge ***":print
95 print"press 'q' to quit"
100 print"how many players? (1-4):";
105 geta$:if((a$<"1")or(a$>"4"))and(a$<>"q")then105
106 printa$:k=val(a$):ifa$="q"then60000
110 ifk=1then140
120 ifk<2ork>4then90
130 goto200
140 z$(1)="":z(1)=1:print:print"enter your name:";:gosub60500:p$(1)=c$
150 print
155 print"try to uncover all of the matches in as few tries as possible"
160 poke214,20:print:print" press the space bar to begin"
170 getq$:ifq$=""then170
180 ifq$<>chr$(32)then170
190 goto275
200 print:print"name of first player:";:gosub60500:p$(1)=c$
210 z$(1)="":z(1)=1
220 print:print"name of second player:";:gosub60500:p$(2)=c$
230 z$(2)="[159]":z(2)=3:ifk=2then275
240 print:print"name of third player:";:gosub60500:p$(3)=c$
250 z$(3)="":z(3)=6:ifk=3then275
260 print:print"name of fourth player:";:gosub60500:p$(4)=c$
270 z$(4)="[158]":z(4)=7
275 pl=1267:lo=1106:tl=0:tr=0
280 rem shuffle cards
290 print:print" please wait while i shuffle the cards."
300 a(1)=int(rnd(1)*36)+1
310 forx=2to36
320 a(x)=int(rnd(1)*36)+1
330 fory=1tox-1:ifa(x)=a(y)theny=1:goto320
340 nexty,x:print"[147]";
350 rem lay down the cards
380 forx=1to4:fory=1to9:printcd$"[145][145][145]";
390 nexty:print"";
400 nextx
410 print" press 'q' to quit"
500 r$="":d$=""
510 l$(1)="":z=2
520 forx=1to4
530 fory=1to8:l$(z)=l$(z-1)+r$:z=z+1:nexty
540 l$(z)=l$(z-9)+d$:z=z+1
550 nextx
560 forx=1to9:fory=1to4
570 c$(a(x),y)=b$(x,y):c$(a(x+18),y)=b$(x,y)
580 nexty,x
590 rem card designs 10-18
600 c$(a(10),1)="[144][172] ":c$(a(28),1)=c$(a(10),1):rem dog
610 c$(a(10),2)="[209] [206]":c$(a(28),2)=c$(a(10),2)
620 c$(a(10),3)=" [146] ":c$(a(28),3)=c$(a(10),3)
630 c$(a(10),4)="[170] [180]":c$(a(28),4)=c$(a(10),4)
640 c$(a(11),1)="[144][169] [223][146]":c$(a(29),1)=c$(a(11),1):rem barn
650 c$(a(11),2)="[180] [170][146]":c$(a(29),2)=c$(a(11),2)
660 c$(a(11),3)="[188] [190][146]":c$(a(29),3)=c$(a(11),3)
670 c$(a(11),4)="[180][144] [170][146]":c$(a(29),4)=c$(a(11),4)
680 c$(a(12),1)=" ":c$(a(30),1)=c$(a(12),1):rem ant
690 c$(a(12),2)="[144]v ":c$(a(30),2)=c$(a(12),2)
700 c$(a(12),3)="[209] ":c$(a(30),3)=c$(a(12),3)
710 c$(a(12),4)="[166][191][191]":c$(a(30),4)=c$(a(12),4)
720 c$(a(13),1)=" ":c$(a(31),1)=c$(a(13),1):rem bull
730 c$(a(13),2)="[144][202][162][203]":c$(a(31),2)=c$(a(13),2)
740 c$(a(13),3)=" [187] [146]":c$(a(31),3)=c$(a(13),3)
750 c$(a(13),4)=" [182][182]":c$(a(31),4)=c$(a(13),4)
760 c$(a(14),1)=" ":c$(a(32),1)=c$(a(14),1):rem bee
770 c$(a(14),2)="[144]v( ":c$(a(32),2)=c$(a(14),2)
780 c$(a(14),3)="[209][158] [144] ":c$(a(32),3)=c$(a(14),3)
790 c$(a(14),4)=" [173][173]":c$(a(32),4)=c$(a(14),4)
800 c$(a(15),1)="[149] [162]":c$(a(33),1)=c$(a(15),1):rem boot
810 c$(a(15),2)=" [220][146]":c$(a(33),2)=c$(a(15),2)
820 c$(a(15),3)="[172][255] [146]":c$(a(33),3)=c$(a(15),3)
830 c$(a(15),4)="[188][162][162][146]":c$(a(33),4)=c$(a(15),4)
840 c$(a(16),1)="[149] [255] ":c$(a(34),1)=c$(a(16),1):rem cowboy
850 c$(a(16),2)="[183]o[144][183]":c$(a(34),2)=c$(a(16),2)
860 c$(a(16),3)="( [146])":c$(a(34),3)=c$(a(16),3)
870 c$(a(16),4)="[144][182][183][181]":c$(a(34),4)=c$(a(16),4)
880 c$(a(17),1)=": [146]":c$(a(35),1)=c$(a(17),1):rem flag
890 c$(a(17),2)=": [146]":c$(a(35),2)=c$(a(17),2)
900 c$(a(17),3)=" [146]":c$(a(35),3)=c$(a(17),3)
910 c$(a(17),4)="[144][182][146] ":c$(a(35),4)=c$(a(17),4)
920 c$(a(18),1)=" ":c$(a(36),1)=c$(a(18),1):rem tractor
930 c$(a(18),2)="[172][188][146][215]":c$(a(36),2)=c$(a(18),2)
940 c$(a(18),3)="[161][162][187][146]":c$(a(36),3)=c$(a(18),3)
950 c$(a(18),4)="[144][215] o":c$(a(36),4)=c$(a(18),4)
960 print"":forx=1to4
970 print" [215] [215] [215] [215] [215] [215] [215] [215] [215]":next
980 w=1:v=1:tr=0:pc=1:pe=0:forx=1tok:sc(x)=0:next
985 ifk>1thenprint"";p$(1);", you begin"
990 ifk=1thenprint"tries ="tr" matches ="tl:poke198,.
995 rem main play
1000 jy=peek(56320):fi=jyand16:jy=15-(jyand15):bl=pl:pokepl,87:pokepl+co,1
1001 geta$:ifa$="[145]"thenjy=1
1002 ifa$="q"then80
1004 ifa$="[145]"thenjy=1
1005 ifa$=""thenjy=2
1006 ifa$=""thenjy=8
1007 ifa$="[157]"thenjy=4
1008 ifa$=chr$(13)thenfi=.
1010 ifjy=1orjy=5orjy=9thenpl=pl-200:goto 1050
1020 ifjy=2orjy=6orjy=10thenpl=pl+200:goto1050
1030 ifjy>3andjy<7thenpl=pl-4
1040 ifjy>7thenpl=pl+4
1050 p$=p$(w):ifk=1thenp$="well done"
1060 ifpe=81thenpokebl,81:pokebl+co,pc
1070 pe=peek(pl):pc=peek(pl+co)
1080 ifpe<>87andpe<>81thenpl=bl:pe=peek(pl):pc=peek(pl+co)
1090 pokepl,160:pokepl+co,z(w):fortt=1to70:nexttt
1100 ifpe=81then1000
1110 iffi<>16then1130
1120 goto1000
1130 forx=1to36:ifpl=d(x)thenz=x:f(v)=pl:goto1150
1140 next
1150 ifv=1thens=z:goto1180
1160 ifz=sthen1000
1170 print" ":t=z:goto1190
1180 forx=1to4:printl$(s);c$(s,x):nextx:v=2:goto1000
1190 forx=1to4:printl$(t);c$(t,x):nextx:v=1:tr=tr+1
1200 ifc$(s,3)<>c$(t,3)then1280
1210 gosub1350:print"";z$(w);p$;", you got a match!!!"
1220 gosub1680:sc(w)=sc(w)+1:tl=tl+1
1230 pokef(1),81:pokef(1)+co,z(w):pokef(2),81
1235 pokef(2)+co,z(w):pe=81:pc=z(w)
1240 fortt=1to100:nexttt
1250 iftl=18then1360
1260 ifk=1then1340
1270 gosub1350:print"";z$(w);"you get to go again!":goto1000
1280 gosub1350:print"";z$(w);"sorry, ";p$(w);"..."
1290 fora=1to500:next
1300 printl$(s);"[158][207][183][208][157][157][157][181][191][182][157][157][157][181][191][182][157][157][157][204][175][186]"
1310 printl$(t);"[207][183][208][157][157][157][181][191][182][157][157][157][180][191][182][157][157][157][204][175][186]":ifk=1then1340
1320 w=w+1:ifw>kthenw=1
1330 gosub1350:print"";z$(w);"it's ";p$(w);"'s turn":goto1000
1340 gosub1350:print"tries = "tr" matches ="tl:goto1000
1350 print" ":return
1360 rem end of game
1370 print"[147]":print:g=g+1:ifg>10theng=1:h=1
1380 ifk=1then1550
1390 print"there was a total of 18 matches:":print
1400 forx=1tok:print" ";p$(x);" found "sc(x)" of them":next
1410 h(g)=sc(1):forx=2tok:ifsc(x)>h(g)thenh(g)=sc(x)
1415 next
1420 print:print"winners...":print
1430 forx=1tok:ifsc(x)<>h(g)then1470
1440 le=18-len(p$(x)):print"game"g" ";p$(x);spc(le);h(g)
1450 h=h+1:w$(h)=p$(x):hs(h)=h(g):g(h)=g:le(h)=le
1460 fort=1to100:nextt
1470 next
1480 print:ifg=1then1510
1490 forx=1toh:print"game"g(x)"[146] ";w$(x);"[146]";spc(le(x));""hs(x)"[146]"
1500 next
1510 print:print" press the space bar to play again"
1512 print" press 'q' to quit"
1515 getjunk$:ifjunk$<>""then1515
1520 getq$:ifq$=""then1520
1525 ifq$="q"then60000
1530 ifq$=chr$(32)then275
1540 end
1550 rem one player statistics
1560 tr(g)=tr
1570 iftr<26thenprint"wow!!!":goto1600
1580 iftr<36thenprint"congratulations!":goto1600
1590 print"good try!"
1600 print"it took you"tr"tries to find the 18 matches."
1610 ifg=1then1640
1620 print:print"your standings...":print
1630 forx=1tog:print"game"x"[146] "tr(x)"[146]":next
1640 print:print"would you like to try again? (y/n)"
1650 getjunk$:ifjunk$<>""then1650
1655 getq$:ifq$=""then1655
1660 ifq$="y"then275
1670 goto60000
1680 rem music
1690 forx=0to23:pokeso+x,0:next
1700 pokeso+2,255:pokeso+5,9:pokeso+24,15
1710 forx=1to8
1720 pokeso+1,n3(x):pokeso,n4(x)
1730 pokeso+4,65:fort=1todr(x):nextt
1740 pokeso+4,64
1750 nextx
1760 return
1790 print"[147]":poke53281,0:poke53280,0:co=54272
1800 so=co:forx=0to23:pokeso+x,0:next:pokeso+2,255:pokeso+5,9:pokeso+24,15
1810 forx=1to33:readn1(x),n2(x):next
1820 forx=1to20:reads(x):t(x)=s(x):next
1830 rem card designs 1-9
1840 b$(1,1)=" [206][181]":b$(1,2)="[206] [181]":rem sailboat
1850 b$(1,3)="[183][183][181]":b$(1,4)="[223] [146][169]"
1860 b$(2,1)=" ":b$(2,2)=" ( ":r